package com.boang.list;

import java.util.ArrayList;
import java.util.Iterator;

/*
    @author:sa
    @date:2024/11/28 14:11
*/
public class ArrayListDemo{
    public static void main(String[] args) {
        ArrayList arrayList = new ArrayList();
        arrayList.add("b");
        arrayList.add("a");
        arrayList.add("c");
//        arrayList.set(1,"A");
//        arrayList.remove(0);
//        System.out.println(arrayList.get(1));
//        System.out.println(arrayList.toString());
//        for (int i = 0; i < arrayList.size(); i++) {
//            System.out.println(arrayList.get(i));
//        }
//        for (Object s:arrayList){
//            System.out.println(s);
//        }

        Iterator iterator = arrayList.iterator();
       while (iterator.hasNext()){
           Object next=iterator.next();
           System.out.println(next);
       }
    }
}